package com.situ.thymeleaf.controller;

import com.situ.thymeleaf.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelExtensionsKt;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

@Controller
@RequestMapping("/url")
public class UrlController {

    @RequestMapping("/getUrlPage")
    public String getUriPage(Model model) {
        Student student = new Student(1, "wangwu", 34, new Date());
        model.addAttribute("student", student);
        return  "url";
    }

    @RequestMapping("/demo")
    @ResponseBody
    public String demo(Integer id, String name) {
        System.out.println("id = " + id + ", name = " + name);
        return  "OK";
    }
}
